<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>业务数据抽取</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <script src="/style/public/publicStyle.js"></script>
    <style type="text/css">
        .layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary] {
            /* width: 100%; */
            padding-left: 28px;
        }


        .layui-table-tool-panel li {
            line-height: 30px;
            -webkit-transition: .5s all;
            transition: .5s all;
            padding-left: 10px;
            padding-right: 47px;
        }

        td .layui-form-select {
            margin-top: -10px;
            margin-left: -15px;
            margin-right: -15px;
        }

        .layui-table-cell {
            overflow: visible !important;
        }

        .layui-table-view .layui-table th {
            overflow: hidden;
        }

        .layui-table-click {
            background-color: #def0f5;
        }
    </style>
</head>

<body>
<!--表格-->
<div class="weadmin-body">
    <div class="layui-row">
        <table class="layui-hide" id="tableDataList" lay-filter="mainTableFilter"></table>
    </div>

</div>

<script type="text/html" id="standField">
    <select name="euType" lay-filter="euType">
        <option value="STRING">字符串</option>
        <option value="NUMBER">数值型</option>
        <option value="BYTE">二进制</option>
        <option value="DATE">日期</option>
        <option value="TIMESTAMP">时间戳</option>
    </select>
</script>
<!--表格操作-->
<script type="text/html" id="op">
    <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete">删除</a>
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="createTb">建表</a>
</script>

<script type="text/html" id="toolbarDemo">
    <input class="text" style="height:35px;width:257px;" name="" id="hiddenFilter" placeholder="根据表名过滤"/>
    <button class="layui-btn layui-btn-normal layui-btn-sm" lay-event="getCheckData">新增</button>
</script>

<div class="layui-row" id="tableForm" style="display:none;">
    <form class="layui-form layui-from-pane" id="formId" style="margin-top:20px" lay-filter="tableForm">
        <div class="layui-col-md10">
            <input type="text"  style="display: none;" name="idTaskOds"/>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md12">
                        <label class="layui-form-label">类型</label>
                        <div class="layui-input-block">
                            <input type="radio" name="euType" value="ods" title="ods" lay-filter="isDim" checked>
                            <input type="radio" name="euType" value="dim" title="dim" lay-filter="isDim">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">任务名称</label>
                        <div class="layui-input-block">
                            <input class="layui-input" name="naTaskOds" id="naTaskOds"/>
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">事件描述</label>
                        <div class="layui-input-block">
                            <input class="layui-input" name="desEvent" id="desEvent"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">业务系统名</label>
                        <div class="layui-input-block">
                            <select name="sdSys" id="sdSysSelect"></select>

                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">启停</label>
                        <div class="layui-input-block">
                            <input type="radio" name="fgStop" value="1" title="停用" checked>
                            <input type="radio" name="fgStop" value="0" title="启用">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">业务数据源</label>
                        <div class="layui-input-block">
                            <select name="idDbSou" lay-filter="idDbSouidDbSou" id="idDbSou"
                                    nextId="naDbSou"></select>
                            <input type="hidden" name="naDbSou" id="naDbSou"/>
                        </div>
                    </div>
                    <div class="layui-col-md6" id="odsTbTar">
                        <label class="layui-form-label">目标表名称</label>
                        <div class="layui-input-block">
                            <input class="layui-input" name="tbTar" id="tbTar"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md12">
                        <label class="layui-form-label">SQL</label>
                        <div class="layui-input-block">
                            <textarea id="qsql" name="qsql" placeholder="请输入内容" style="height: 200px"
                                      class="layui-textarea"></textarea>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md12">
                        <label class="layui-form-label">前置SQL</label>
                        <div class="layui-input-block">
                            <textarea id="beforSql" name="beforSql" placeholder="请输入内容"
                                      class="layui-textarea"></textarea>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md12">
                        <label class="layui-form-label">后置SQL</label>
                        <div class="layui-input-block">
                            <textarea id="afterSql" name="afterSql" placeholder="请输入内容"
                                      class="layui-textarea"></textarea>
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <div class="layui-col-md2">
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md12">
                        <div class="layui-card" style="margin: 18px 10px 0px 10px">
                            <div class="layui-card-header">参数列表</div>
                            <div class="layui-card-body">
                                开始时间参数<br>
                                Date格式：${DT_DAY_BEGIN}<br>
                                文本格式：${D_BEGIN}<br>
                                <br>
                                结束时间参数<br>
                                Date格式：${DT_DAY_END}<br>
                                文本格式：${D_END}<br>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md12">
                        <button class="layui-btn layui-btn-normal layui-btn-submit " lay-submit="" lay-filter="demo11"
                                style="margin-left:42px">保存
                        </button>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md12">
                        <button type="button" id="testQsql" class="bn layui-btn layui-btn-normal"
                                style="margin-left:32px">
                            检查SQL
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<div class="layui-row" id="tableForm2" style="display:none;">
    <div class="layui-col-md12">
        <input type="text"  style="display: none;" name="idTaskOds"/>
        <div class="layui-form-item">
            <form class="layui-form layui-from-pane" id="formId3" style="margin-top:20px" lay-filter="tableForm11">
                <div class="layui-row">
                    <div class="layui-form-item">
                        <div class="layui-col-md6">
                            <label class="layui-form-label">任务名称</label>
                            <div class="layui-input-block">
                                <input class="layui-input" disabled="disabled" name="naTaskOds" id="naTaskOdsDDL"/>
                                <input class="layui-input" type="hidden" name="idTaskOds" id="idTaskOdsDDL"/>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <label class="layui-form-label">事件描述</label>
                            <div class="layui-input-block">
                                <input class="layui-input" disabled="disabled" name="desEvent" id="desEventDDL"/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">目标表名称</label>
                        <div class="layui-input-block">
                            <input class="layui-input" disabled="disabled" name="tbTar" id="tbTarDDL"/>
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <div class="layui-input-block">
                            <a type="button" id="execSql" onclick="execSql()"
                               class="layui-btn layui-btn-normal"
                               style="margin-left:-59px;text-align: right; margin-right: 29px;">创建</a>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div class="layui-form-item">
            <div class="layui-row">
                <div class="layui-col-md12">
                    <table class="layui-hide" id="tableColumnList"
                           lay-filter="tableColumnList"></table>
                </div>
            </div>
        </div>
    </div>
</div>

</body>

<script>
    layui.use(['util', 'laydate', 'laypage', 'layer', 'table', 'carousel', 'upload', 'element'], function () {
        var currPage;
        var util = layui.util;
        var laydate = layui.laydate //日期
            , laypage = layui.laypage //分页
            , layer = layui.layer //弹层
            , table = layui.table //表格
            , carousel = layui.carousel //轮播
            , upload = layui.upload //上传
            , element = layui.element //元素操作
            , form = layui.form;
        var logintoken = null;
        getSharreTieba_LoginToken();
        table.render({
            elem: '#tableDataList'
            , even: false //开启隔行背景
            , cellMinWidth: 80
            , toolbar: '#toolbarDemo'
            , defaultToolbar: []
            , url: global_visit_url_prefix + '/etl/etlTaskOds/findByPage'
            , cols: [[
                , {field: 'idTaskOds', title: 'ID', hide: true}
                , {field: 'qsql', title: 'qsql', hide: true}
                , {field: 'beforSql', title: 'beforSql', hide: true}
                , {field: 'afterSql', title: 'afterSql', hide: true}
                , {field: 'naTaskOds', title: '名称'}
                , {field: 'desEvent', title: '事件'}
                , {field: 'euType', title: '类型'}
                , {field: 'sdSys', title: '来源系统'}
                , {field: 'idDbSou', title: '数据源', hide: true}
                , {field: 'naDbSou', title: '数据源'}
                , {field: 'tbTar', title: '目标表'}, {
                    field: 'fgStop', title: '启停', templet: function (d) {
                        return d.fgStop == "0" ? "启用" : "停用";
                    }
                }
                , {fixed: 'right', title: '操作', align: 'center', toolbar: '#op'}
            ]]
            , page: true
            , done: function (rest, curr, count) {
                currPage = curr;
            }
        });

        $.ajax({
            url: '/etl/mdMedPubfld/findDimTable',
            type: 'get',
            dataType: 'json',
            contentType: 'application/json;charset=UTF-8',
            success: function (data1) {
                var data = data1.data; //提出返回数据中的data
                form.val("tableForm", data);
                if (data !== null) {
                    $.each(data, function (index, item) { //循环加入 data的元素
                        $("#mainSelectId").append('<option value="' + item + '">' + item + '</option>');
                    });
                    form.render('select');
                }
            }
        });

        var switchOdsAndDim = function (data) {
            if (data == 'ods') {
                $("#odsTbTar").show();
                $("#dimTbTar").hide();
                $("#desEvent").attr("disabled", false);
                var val = $("#desEvent").val();
                if (val == '维度表抽取') {
                    $("#desEvent").val("");
                }
            } else {
                $("#odsTbTar").hide();
                $("#dimTbTar").show();
                $("#desEvent").attr("disabled", true);
                $("#desEvent").val("维度表抽取");
            }
        }

        form.on('radio(isDim)', function (data) {
            switchOdsAndDim(data.value);
        });

        table.render({
            elem: '#tableColumnList'
            , even: false //开启隔行背景
            , id: 'tableColumnList'
            , url: global_visit_url_prefix + '/etl/etlTaskOds/gerTableColumns'
            , where: {'idTaskOds': ''}
            , cols: [[
                , {field: 'newColumnName', title: '列名'}
                , {field: 'newColumnTypeName', title: '类型', width: 116}
                , {field: 'newColumnPrecision', title: '长度', edit: 'text', width: 60}
                , {field: 'newColumnScale', title: '精度', edit: 'text', width: 50}
                , {
                    field: 'oldColumnTypeName', title: 'ODS原类型', templet: function (d) {
                        if (d.oldColumnPrecision != undefined && d.oldColumnPrecision != 'undefined' && d.oldColumnPrecision != '') {
                            if (d.oldColumnScale != undefined && d.oldColumnScale != 'undefined' && d.oldColumnScale != '') {
                                return d.oldColumnTypeName + ' (' + d.oldColumnPrecision + ',' + d.oldColumnScale + ')';
                            } else {
                                return d.oldColumnTypeName + ' (' + d.oldColumnPrecision + ')';
                            }
                        } else {
                            if (d.oldColumnTypeName != undefined && d.oldColumnTypeName != 'undefined' && d.oldColumnTypeName != '') {
                                return d.oldColumnTypeName;
                            } else {
                                return '';
                            }
                        }
                    }
                    , width: 180
                }
                , {
                    field: 'opType', title: '操作', templet: function (d) {
                        if (d.opType == "OP_TYPE_ADD") {
                            return "添加";
                        } else if (d.opType == "OP_TYPE_DROP") {
                            return "删除";
                        } else if (d.opType == "OP_TYPE_MODIFY") {
                            return "修改";
                        } else {
                            return "不变";
                        }
                    }
                    , width: 60
                }
            ]]
        });


        $("body").on("keypress", "#hiddenFilter", function (event) {
            var content = $(this).val();
            if (event.keyCode == '13') {
                //执行重载
                table.reload('tableDataList', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    , where: {
                        filter: content		//在表格中进行搜索
                    }
                });
                $("#hiddenFilter").val(content);
            }
        });

        layui.$('#testQsql').on('click', function () {
            $.ajax({
                url: '/etl/runJob/testSql',
                type: 'get',
                data: {SQL: $("#qsql").val(), idDbSou: $("#idDbSou").val()},
                success: function (data1) {
                    alert(data1.msg);
                }
            });
        });

        var indexLay;
//监听行工具事件
        table.on('tool()', function (obj) { //注：tool 是工具条事件名，mainTableFilter 是 table 原始容器的属性 lay-filter="对应的值"
            var data = obj.data //获得当前行数据
                , layEvent = obj.event; //获得 lay-event 对应的值
            if (layEvent == 'edit') {

                indexLay = layer.open({
                    //layer提供了5种层类型。可传入的值有：0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）
                    type: 1,
                    title: "ODS抽取配置",
                    area: ['950px', '600px'],
                    content: $("#tableForm")//引用的弹出层的页面层的方式加载修改界面表单

                });
                //动态向表传递赋值可以参看文章进行修改界面的更新前数据的显示，当然也是异步请求的要数据的修改数据的获取
                setFormValue(obj, data);
                switchOdsAndDim(data.euType);
                /*getTables(data.idDbSou)*/
            } else if (layEvent == 'delete') {

                layer.confirm('确定要删除吗？', {
                    btn: ['确定', '取消'], //按钮
                }, function () {
                    layer.closeAll('dialog');
                    $.ajax({
                        type: "get",
                        url: "/etl/etlTaskOds/delete",
                        async: true,
                        data: {'idTaskOds': data.idTaskOds},
                        success: function (json) {
                            if (json.euStatus == 'SUCCESS') {
                                alert("删除成功!");
                                table.reload("tableDataList");
                            } else {
                                alert(json.data);
                            }

                        }
                    });
                });
            } else if (layEvent == 'createTb') {
                if (data.euType == 'dim') {
                    alert("维度表已创建，如需修改表请跳转[维度表管理]")
                    return;
                }

                layer.open({
                    //layer提供了5种层类型。可传入的值有：0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）
                    type: 1,
                    title: "ODS建表",
                    area: ['850px', '600px'],
                    content: $("#tableForm2")//引用的弹出层的页面层的方式加载修改界面表单
                });
                setFormValue2(obj, null);
                setFormValue2(obj, data);
                /* showDDLSql();*/
                showDDLColumn();
            }
        });

        function setFormValue2(obj, data) {
            if (data == null) {
                $("#formId3")[0].reset();
            } else {
                form.val("tableForm11", data);
            }
        }

        var tableReload = function (tableId) {
            var outIdBase = $("#outIdBase").val();
            if (outIdBase != '') {
                $.ajax({
                    url: '/etl/etlBaseField/find',
                    type: 'get',
                    data: {'idBase': $("#outIdBase").val()},
                    success: function (msg) {
                        table.reload(tableId, {data: msg.data});
                    }
                })
            } else {
                table.reload(tableId, {data: []});
            }
        };
        var editFieldButton = function () {
            $("#filedtoolbarDiv").html(
                '<button class="layui-btn layui-btn-sm" lay-event="addField">新增</button>' +
                '<button class="layui-btn layui-btn-sm" lay-event="saveField">保存</button>' +
                '<<button class="layui-btn layui-btn-sm" lay-event="returnBack">返回</button>');
        };
//内容改变出发
        $("#tbNa").on("input", function (e) {
            //获取input输入的值
            var tbNa = e.delegateTarget.value;
            var idDbSou = document.getElementById("idDbSou").value;
            alert(document.getElementById("idDbSou").text());

        });
        //监听表头
        table.on('toolbar()', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id);
            switch (obj.event) {
                case 'getCheckData':
                    layer.open({
                        //layer提供了5种层类型。可传入的值有：0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）
                        type: 1,
                        title: "新增ODS抽取任务",
                        area: ['950px', '600px'],
                        content: $("#tableForm")//引用的弹出层的页面层的方式加载修改界面表单
                    });
                    setFormValue(obj, null);
                    switchOdsAndDim('ods');
                    break;
                case 'addField':
                    var tableData = table.cache.fileTable;
                    if (tableData == null) {
                        tableData = [];
                    }
                    tableData.push({
                        "euType": "STRING"
                    });
                    table.reload("fileTable", {data: tableData});
                    editFieldButton();
                    break;
                case 'addRapid' :
                    var tableData = table.cache.fileTable;
                    if (tableData.length > 0) {
                        layer.alert("请先删除已有数据");
                        return;

                    }
                    var outIdBase = $("#outIdBase").val();

                    if (outIdBase != '') {
                        $.ajax({
                            url: '/etl/etlBaseField/findByAuto',
                            type: 'get',
                            data: {'idBase': outIdBase},
                            success: function (msg) {
                                table.reload("fileTable", {data: msg.data});
                                editFieldButton();
                            }
                        })
                    } else {
                        layer.alert("请先选择任务");
                    }
                    break;
                case 'saveField':

                    var data = obj.config.data;
                    if (data.length > 0) {
                        $.ajax({
                            url: '/etl/etlBaseField/saveList',
                            type: 'post',
                            dataType: 'json',
                            contentType: 'application/json;charset=UTF-8',
                            data: JSON.stringify(data),
                            success: function (msg) {
                                table.reload("fileTable", msg.data);
                            }
                        });
                    } else {
                        layer.alert("数据不能为空");
                    }
                    break;
                case 'editField':
                    editFieldButton();
                    break;
                case 'returnBack':
                    layer.confirm('返回会导致已变更数据的丢失，是否继续？', {
                        btn: ['继续', '取消'], //按钮
                    }, function () {
                        layer.closeAll('dialog');
                        tableReload("fileTable");
                    });
                    break;

            }
            ;
        });

        //监听行单击事件（双击事件为：rowDouble）
        table.on('row(mainTableFilter)', function (obj) {
            var data = obj.data;
            $("#outSql").val(data.qsql);
            $("#outIdBase").val(data.idBase);
            obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
            tableReload("fileTable");
        });

        //监听弹出框表单提交，massage是修改界面的表单数据'submit(demo11),是修改按钮的绑定
        function setFormValue(obj, data) {
            debugger;
            if (data == null) {
                $("#formId")[0].reset();
                form.render();
            } else {
                form.val("tableForm", data);
            }
            form.on('submit(demo11)', function (massage) {
                if (massage.field.euType == 'dim') {
                    massage.field.tbTar = $("#mainSelectId").val();
                    var tbTar = massage.field.tbTar;
                    if (tbTar.substr(0, 3) != "MD_" && tbTar.substr(0, 3) != "md_") {
                        alert("维度表名需要以[MD_]开头");
                        return false;
                    }

                } else {
                    massage.field.euType = 'ods'
                    massage.field.tbTar = $("#tbTar").val();
                    var tbTar = massage.field.tbTar;
                    if (tbTar.substr(0, 4) != "ODS_" && tbTar.substr(0, 4) != "ods_") {
                        layer.alert("ODS表名需要以[ODS_]开头");
                        return false;
                    }
                }

                $.ajax({
                    url: '/etl/etlTaskOds/save',
                    type: 'post',
                    dataType: 'json',
                    async: false,
                    contentType: 'application/json;charset=UTF-8',
                    data: JSON.stringify(massage.field),
                    success: function (msg) {
                        if (msg.code == 1) {
                            layer.alert(msg.msg);
                        } else {
                            table.reload("tableDataList", {page: {curr: currPage}});
                        }
                    }
                });
                layer.closeAll();
                return false;
            })


        }
    });


    layui.use('form', function () {
        var $ = layui.$;
        var form = layui.form;
        $.ajax({
            url: '/etl/baseDb/findEnableDB',
            type: 'get',
            success: function (data1) {
                var data = data1.data; //提出返回数据中的data
                $("#idDbSou").empty();//清空默认值
                $("#naDbSou").empty();//清空默认值
                if (data !== null) {
                    var flag = true;
                    $.each(data, function (index, item) { //循环加入 data的元素
                        $("#idDbSou").append("<option value='" + item.idDb + "'>" + item.na + "</option>");
                        $("#idDbTar").append("<option value='" + item.idDb + "'>" + item.na + "</option>");
                        if (flag) {
                            $("#naDbSou").val(item.na);
                            $("#naDbTar").val(item.na);
                            flag = false;
                        }
                    });
                }
                ;
            }
        });

        $.ajax({
            url: '/med/baseSdItem/findByCdSd',
            type: 'get',
            data: {'cdSd': 'sys'},
            contentType: 'application/json;charset=UTF-8',
            success: function (data1) {
                var data = data1.data; //提出返回数据中的data
                $("#sdSysSelect").empty();//清空默认值
                if (data !== null) {
                    var flag = true;
                    $.each(data, function (index, item) { //循环加入 data的元素
                        $("#sdSysSelect").append("<option value='" + item.cd + "'>" + item.na + "</option>");
                        if (flag) {
                            $("#sdSysSelect").val(item.na);
                            flag = false;
                        }
                    });
                }
            }
        });

        form.render('select');

        form.on('select', function (data) {
            var nextId = data.elem.attributes.nextid;
            if (nextId != null) {
                $("#" + nextId.value).val($(this).text());
            }
        });
        form.on('select(euType)', function (data) {

            var elem = $(data.elem);
            var trElem = elem.parents('tr');
            // 更新到表格的缓存数据中，才能在获得选中行等等其他的方法中得到更新之后的值
            var tableData = layui.table.cache.fileTable;
            tableData[trElem.data('index')][elem.attr('name')] = data.value;
            form.render('select');
        })
    });

    var showDDLSql = function () {
        $("#execSqlModify .layui-card-body").html("");
        $("#execSqlCreate .layui-card-body").html("");

        $.ajax({
            url: global_visit_url_prefix + '/etl/etlTaskOds/gerTableDDL',
            type: 'get',
            dataType: 'json',
            data: {'idTaskOds': $("#idTaskOdsDDL").val()},
            contentType: 'application/json;charset=UTF-8',
            success: function (data1) {
                if (data1.code == 1) {
                    alert(data1.msg);
                    return;
                }
                var strs = data1.data.createSQL.split(";"); //字符分割

                for (i = 0; i < strs.length; i++) {
                    $("#execSqlCreate .layui-card-body").append(strs[i] + "; <br/>")
                }

                if (data1.data.modifySQL != undefined && data1.data.modifySQL != undefined && data1.data.modifySQL != '') {
                    strs = data1.data.modifySQL.split(";"); //字符分割
                    for (i = 0; i < strs.length; i++) {
                        $("#execSqlModify .layui-card-body").append(strs[i] + "; <br/>")
                    }
                }

                /* $("#execSqlModify").html(data1.data.modifySQL);
                 /!*$("#execSqlCreate").html(data1.data.createSQL);*!/*/
            }
        });
    }
    var showDDLColumn = function () {

        layui.table.reload("tableColumnList", {where: {'idTaskOds': $("#idTaskOdsDDL").val()}});
    }


    var showExecTypesSql = function (obj) {
        if ($("#execTypes").hasClass("usrCreate")) {
            $("#execSqlModify").show();
            $("#execSqlCreate").hide();
            $("#execTypes").html('使用创建语句')
            $("#execTypes").removeClass("usrCreate")
        } else {
            $("#execSqlModify").hide();
            $("#execSqlCreate").show();
            $("#execTypes").html('使用修改语句')
            $("#execTypes").addClass("usrCreate")
        }
    }

    var execSql = function () {
        $.ajax({
            url: global_visit_url_prefix + '/etl/etlTaskOds/execTableDDLColumns',
            type: 'post',
            dataType: 'json',
            data: JSON.stringify({
                columns: layui.table.getData("tableColumnList"),
                taskId: $("#idTaskOdsDDL").val()
            }),
            contentType: 'application/json;charset=UTF-8',
            success: function (data1) {
                if (data1.code == 1) {
                    alert(data1.msg);
                    return;
                }
                layui.table.reload("tableColumnList", {where: {'idTaskOds': $("#idTaskOdsDDL").val()}});
                alert('执行成功!');
            }
        });
    }
</script>

</html>